package com.example.votemanage.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.votemanage.entity.VoteItem;
import com.example.votemanage.entity.VoteOption;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xingcheng
 * @since 2024-06-06
 */
public interface VoteOptionMapper extends BaseMapper<VoteOption> {
    @Select("select * from vote_option where vs_id = #{vsId}")
    @Results(id="VoteOption", value = {
            @Result(property = "voId", column = "vo_id"),
            @Result(property = "voteItems", column = "vo_id", many = @Many(select = "com.example.votemanage.mapper.VoteItemMapper.selectByVoId"))
    })
    List<VoteOption> selectByVsId(Integer vsId);
    @Select("select * from vote_option where vo_id = #{voId}")
    List<VoteOption> selectByVoId(Integer[] voId);
}
